<?php

/*
|--------------------------------------------------------------------------
| Web Routes
|--------------------------------------------------------------------------
|
| Here is where you can register web routes for your application. These
| routes are loaded by the RouteServiceProvider within a group which
| contains the "web" middleware group. Now create something great!
|
*/

Route::get('/', function () {
    // return redirect('/login');
    return view('love');
});

// 用户模块
// 注册
Route::get('/register','\App\Http\Controllers\RegisterController@index');
// 注册逻辑
Route::post('/register','\App\Http\Controllers\RegisterController@register');
// 登录
Route::get('/login','\App\Http\Controllers\LoginController@index');
// 登录逻辑
Route::post('/login','\App\Http\Controllers\LoginController@login');
// 登出逻辑
Route::get('/logout','\App\Http\Controllers\LoginController@logout');
// 个人设置
Route::get('/user/me/setting','\App\Http\Controllers\UserController@setting');
// 个人设置逻辑
Route::post('/user/me/setting','\App\Http\Controllers\UserController@settingStore');

// 文章列表页
Route::get('/posts','\App\Http\Controllers\PostController@index');
// 创建文章
Route::get('/posts/create','\App\Http\Controllers\PostController@create');
// 文章详情页
Route::get('/posts/{post}','\App\Http\Controllers\PostController@show');
Route::post('/posts','\App\Http\Controllers\PostController@store');
// 编辑文章
Route::get('/posts/{post}/edit','\App\Http\Controllers\PostController@edit');
Route::put('/posts/{post}','\App\Http\Controllers\PostController@update');
//删除文章
Route::get('/posts/{post}/delete','\App\Http\Controllers\PostController@delete');
// 图片上传
Route::post('/posts/image/upload','\App\Http\Controllers\PostController@imageUpload');
// 提交评论
Route::post('/posts/{post}/comment','\App\Http\Controllers\PostController@comment');

// 点赞
Route::get('/posts/{post}/like','\App\Http\Controllers\PostController@like');
// 取消赞
Route::get('/posts/{post}/unlike','\App\Http\Controllers\PostController@unlike');